package com.emellend.api11.preference;

import java.util.List;
import com.emellend.api11.R;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.preference.PreferenceFragment;
import android.util.Log;
import android.widget.Button;

public class PreferenceWithHeaders extends PreferenceActivity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		if (hasHeaders()) {
			Button button=new Button(this);
			button.setText("Some action");
			setListFooter(button);
		}
		
	}
	@Override
	public void onBuildHeaders(List<Header> target) {
		super.onBuildHeaders(target);
		loadHeadersFromResource(R.xml.preference_headers, target);
	}
	
	public static class Prefs1Fragment extends PreferenceFragment{
		@Override
		public void onCreate(Bundle savedInstanceState) {
			super.onCreate(savedInstanceState);
			addPreferencesFromResource(R.xml.fragmented_preferences);
		}
	}
	
	public static class Prefs1FragmentInner extends PreferenceFragment{
		@Override
		public void onCreate(Bundle savedInstanceState) {
			super.onCreate(savedInstanceState);
			 // Can retrieve arguments from preference XML.
            Log.i("args", "Arguments: " + getArguments());
            addPreferencesFromResource(R.xml.fragmented_preferences_inner);
		}
	}
	
	public static class Prefs2Fragment extends PreferenceFragment{
		@Override
		public void onCreate(Bundle savedInstanceState) {
			super.onCreate(savedInstanceState);
			// Can retrieve arguments from headers XML.
            Log.i("args", "Arguments: " + getArguments());
			addPreferencesFromResource(R.xml.preference_dependencies);
		}
	}
}
